//
//  UserLikeCollectionViewCell.m
//  one·一个  tyw
//
//  Created by tyw on 15/9/15.
//  Copyright (c) 2015年 tyw. All rights reserved.
//

#import "UserLikeCollectionViewCell.h"
#import "UIImageView+WebCache.h"

@implementation UserLikeCollectionViewCell {
    UIImageView* imgView;
}

- (instancetype)initWithFrame:(CGRect)frame {
    if (self = [super initWithFrame:frame]) {
        
        imgView = [[UIImageView alloc] initWithFrame:CGRectMake(2, 2, self.bounds.size.width-4, self.bounds.size.height-4)];
        [self.contentView addSubview:imgView];
    }
    
    return self;
}


- (void)setDataDic:(NSDictionary *)dataDic {
    _dataDic = dataDic;
    
    [self setNeedsLayout];
}

- (void)layoutSubviews {
    [super layoutSubviews];
    
    //得到图片url
    NSString* urlStr = _dataDic[@"strBu"];
    //网络请求图片 并设置
    if (urlStr.length > 0) {
        [imgView sd_setImageWithURL:[NSURL URLWithString:urlStr]];
    }
//    NSData* data = [NSData dataWithContentsOfURL:[NSURL URLWithString:urlStr]];
//    UIImage* image = [UIImage imageWithData:data];
//    imgView.image = image;
}

@end
